
import AdManager, { Platform } from "../../../Platforms/AdManager";
import { FormType } from "../../../UIFrame/config/SysDefine";
import UIBase from "../../../UIFrame/UIBase";
import UIManager from "../../../UIFrame/UIManager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class TouTiaoAdUI extends UIBase {

    formType = FormType.PopUp;

    static prefabPath = "prefabs/UIForms/adUI/TouTiaoAdUI";

    onShow(type) {

        AdManager.getInstance().platform = Platform.toutiao_H5;
        AdManager.getInstance().onInit(() => { });
    }

    onLoad() {
    }

    start() {

    }

    async showAnimation() {
        console.log('重写打开动画');
    }

    onClickEvent_openBanner() {
        AdManager.getInstance().showBanner('banner', 'bannerOpenId');
    }

    onClickEvent_openInsert() {
        AdManager.getInstance().showInsertAd('insert', 'insertOpenId');
    }

    onClickEvent_openVideo() {
        AdManager.getInstance().showVideo('video', () => {
            console.log('成功回调');
        }, () => {
            console.log('失败回调');
        });
    }

    onClickEvent_startRecord() {
        AdManager.getInstance().startRecordScreen();
    }

    onClickEvent_stopRecord() {
        AdManager.getInstance().stopRecordScreen();
    }

    onClickEvent_onShareVideo() {
        AdManager.getInstance().onShareVideo((res) => {
            if (res == 1) {
                console.log('分享录屏==>成功');
            } else if (res == 0) {
                console.log('分享录屏==>失败');
            }
        });
    }

    onHide() {

    }
}
